<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    
    <link rel="stylesheet" href="<%=request.getContextPath()%>/js/css/bootstrap.min.css">
    <title>人员管理</title>
	
	
  </head>

<body>
 <div class="container">
  <ul class="nav nav-tabs ">
  <li role="presentation" class="active"><a href="#">人员管理</a></li>
  <li role="presentation"><a href="../dept/deptlist">部门管理</a></li>
  <li role="presentation"><a href="../main">地址管理</a></li>
  <li role="presentation"><a href="../main">权限管理</a></li>
     
   </ul>
   <div class="text-right">
    <p >欢迎您,${user.username }</p>
    <a  href="../loginout" >注销</a>
    </div>
   </div>
   <br><br>
 <div class="container" >
 
   <form class="form-inline" id="emploee_list">
   <div class="col-xs-1" ></div>
  <div class="form-group col-xs-4">
    <label for="exampleInputName2">姓名</label>
     <input type="text" class="form-control" placeholder="输入姓名" id="name"/>
  </div>
  <div class="form-group col-xs-4">
    <label for="exampleInputEmail2">部门</label>
    <select class="form-control " id="dept_id">
        <option value="">请选择部门</option>
        <c:forEach items = "${deptlist}" var = "dept"  >
        <option value="${dept.id }">${dept.deptName }</option>
       </c:forEach>
      </select>
  </div>
  <input type="button" class="btn btn-default" value="查询" onclick="search()"  />
    <input type="button" class="btn btn-default" value="新增" onclick="empadd()"  />
    <input type="button" class="btn btn-default" value="删除" onclick="empdel()"  />
</form>
 </div>
 
 
 
 
    
    <div class="container" id="emploee_edit"  />
    
   
    
    
    
</body>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/js/bootstrap.min.js"></script>
<%-- <script type="text/javascript" src="<%=request.getContextPath()%>/js/layer/layer.js"></script> --%>
<script type="text/javascript"> 
  $(function(){	
		search();
	});
	function search(){
		var dept_id=$("#dept_id").val();
		var name=$("#name").val();
		/* alert(name); */
		$("#emploee_edit").load("emploee_edit",{"dept_id":dept_id,"name":name});
	}
  function empadd(){
      $("#myModal select").val("");    //清空select选项
  	  $("#myModal input").val("");     //清空input元素内容
  	  $("#myModal input").last().val(0);
      $("#myModal").modal("show");     //显示模态框
  }
 
  
    
 function empdel(){  //jquery获取复选框值    
   var chk_value =[]; 
   var ids ="";   
   $('input[type="checkbox"]:checked').each(function(){    
   chk_value.push($(this).parent("td").parent("tr").attr("id")); 
      ids+= $(this).parent("td").parent("tr").attr("id")+",";
  });    
  alert(ids);
 
   $.post("emploee_del",{ids : ids},
        function(){
        $("#emploee_edit").load("emploee_edit")
        }
        ); 
    
}    
 
 
 
</script>
</html>
